﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="AnyOffice.general.file_folder.index" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>个人文件柜</title>
		<SCRIPT language="javascript" type="text/javascript">
		function jump(path)
		{
			URL = "index.aspx?path=" + path;
			window.location = URL;
		}
		
		 function CheckAll( checkAllBox )                         
		{                                                                  
		var frm = document.Form1;                               
		var ChkState=checkAllBox.checked;                   
		for(i=0;i< frm.length;i++)                                 
		{                                                                 
				e=frm.elements[i];                                   
				if(e.type=='checkbox' && e.name.indexOf('PathId') != -1)
					e.checked= ChkState ;                        
		}                                                               
		}                                                                
		                           
		function CheckChanged()                                   
		{                                                                   
		var frm = document.Form1;                              
		var boolAllChecked;                                         
		boolAllChecked=true;                                       
		for(i=0;i< frm.length;i++)                                 
		{                                                                 
			e=frm.elements[i];                                        
		if ( e.type=='checkbox' && e.name.indexOf('PathId') != -1 )
			if(e.checked== false)                                  
			{                                                             
				boolAllChecked=false;                               
				break;                                                    
			}                                                              
		}                                                                  
		for(i=0;i< frm.length;i++)                                  
		{                                                                  
			e=frm.elements[i];                                         
			if ( e.type=='checkbox' && e.name.indexOf('checkAll') != -1 )
			{                                                            
			if( boolAllChecked==false)                         
				e.checked= false ;                                
				else                                                    
				e.checked= true;                                  
			break;                                                    
			}                                                             
		}                                                              
		}
		
		function delete_confirm()
		{
			var boolChecked = false;
			var frm = document.Form1;
			for(i=0;i< frm.length;i++)                                 
			{                                                                 
				e=frm.elements[i];                                        
				if ( e.type=='checkbox' && e.name.indexOf('PathId') != -1 )
				if(e.checked== true)                                  
				{                                                             
					boolChecked = true;                               
					break;                                                 
				}                                                              
			}
			if(boolChecked == false)
			{
				alert("请选择要删除的文件或文件夹！");
				return false;
			}     
			msg='你确定要删除选定的文件或文件夹么？';
			if(window.confirm(msg))
				return true;
			else
				return false;
		}
		
		function move_confirm()
		{
			var boolChecked = false;
			var frm = document.Form1;
			for(i=0;i< frm.length;i++)                                 
			{                                                                 
				e=frm.elements[i];                                        
				if ( e.type=='checkbox' && e.name.indexOf('PathId') != -1 )
				if(e.checked== true)                                  
				{                                                             
					boolChecked = true;                               
					break;                                                 
				}                                                              
			}
			if(boolChecked == false)
			{
				alert("请选择要移动的文件或文件夹！");
				return false;
			}     
			return true;
		}		
		  
		</SCRIPT>
	</HEAD>
	<body class="bodycolor" topMargin="5">
		<form id="Form1" method="post" runat="server">
         <div class="main_div">
			<TABLE class="small" cellSpacing="0" cellPadding="3" width="100%" border="0">
				<TR>
					<TD class="tab_ti"><SPAN class="big3">
							个人文件柜</SPAN>
					</TD>					
				</TR>
			</TABLE>
			<asp:Panel id="pnlMain" runat="server">				
				
				<TABLE class="small" cellSpacing="1" cellPadding="3" width="100%" border="0">
					<TR>
						<TD noWrap colSpan="5" class="big">当前文件夹
							<asp:DropDownList id="currentFolder" runat="server" CssClass="BigSelect" AutoPostBack="True" onselectedindexchanged="currentFolder_SelectedIndexChanged"></asp:DropDownList>&nbsp;
							<asp:Button id="btnNewFloder" runat="server" CssClass="bnt_Add" Text="新建文件夹" onclick="btnNewFloder_Click"></asp:Button>&nbsp;
							<asp:Button id="btnFolderAttribute" runat="server" CssClass="bnt_Attr" Text="属性" onclick="btnFolderAttribute_Click"></asp:Button>
							&nbsp;&nbsp;
							<a href="search.aspx"><IMG src="report_search.gif" width="18" height="18" border="0" align="absmiddle">&nbsp;搜索文件</a>
							</TD>
					</TR>
				</TABLE>
					<table width="100%" cellSpacing="0" cellPadding="0" border="0" class="tab_pub" align="center">
				<tr>
					<td noWrap class="TableHeader" align="center" width="30">选择</td>
					<td noWrap class="TableHeader">名称</td>					
					<td noWrap class="TableHeader" align="center">大小</td>
					<td noWrap class="TableHeader" align="center">类型</td>
					<td noWrap class="TableHeader" align="center">创建/上传时间</td>
					<td noWrap class="TableHeader" align="center" width="80">操作</td>
				</tr>
				<asp:Panel id="pnlJumpParent" runat="server" Visible="False">
					<tr class="TableLine1">
						<td nowrap  width="30">&nbsp;</td>
						<td nowrap colspan="5">
							<A href="index.aspx?path=<% =Server.UrlEncode(ViewState["ParentPath"].ToString()) %>"title="返回上一级目录"><IMG src="folder-up.gif" width="16" height="16" border="0" align="absMiddle">&nbsp;返回上一级目录</A>
						</td>
					</tr>
				</asp:Panel>
				<asp:Repeater id="rptInfo" runat="server">
					<ItemTemplate>
						<tr class="TableLine1">
							<td nowrap  width="30" align="center">
							<input type="checkbox" runat="server" id="PathId" onClick="CheckChanged();" name="PathId" value='<%# (Convert.ToBoolean(Eval("isDirectory")) == true) ? "DIR" + Eval("path") : "FILE" + Eval("path").ToString() %>' />
							</td>
							<td nowrap>								
								<%#Convert.ToBoolean(Eval("isDirectory")) == true ? "<A href=\"index.aspx?path=" + Server.UrlEncode(Eval("path").ToString()) + "\">" : ""%>
								<%#Convert.ToBoolean(Eval("isDirectory")) == false ? "<A target=\"download_file\" href=\"download.aspx?filename=" + Server.UrlEncode(Eval("path").ToString()) + "\">" : ""%>
								<img src="/images/files/<%#Eval("img")%>" align="absMiddle" border="0">
								<%#Eval("name")%></a>
								<%#Thumb(Eval("path").ToString(), "120") %>
								<%#OfficeMenu(Eval( "path").ToString())%>						
							</td>
							<td nowrap align="center"><%#Convert.ToBoolean(Eval("isDirectory")) == false ? formatSize(Convert.ToInt32(Eval("size"))) : "-" %></td>
							<td noWrap align="center"><%#Convert.ToBoolean(Eval("isDirectory")) == true ? "目录" : "文件"%></td>
							<td nowrap align="center"><%#Eval("creationTime") %></td>
							<td nowrap width="80">
							&nbsp;
							<%#Convert.ToBoolean(Eval("isDirectory")) == false ? "<A target=\"download_file\" href=\"download.aspx?filename=" + Server.UrlEncode(Eval("path").ToString()) + "\" title=\"下载文件\"><img src=\"down.gif\" border=\"0\" align=\"absmiddle\"></a>" : ""%>
							<%#Convert.ToBoolean(Eval("isDirectory")) == false ? "<A href=\"changefile.aspx?filename=" + Server.UrlEncode(Eval("path").ToString()) + "\" title=\"属性/重命名\"><img src=\"props.gif\" border=\"0\" align=\"absmiddle\"></a>" : ""%>
							<%#Convert.ToBoolean(Eval("isDirectory")) == true ? "<A href=\"newfile.aspx?parent_folder=" + Server.UrlEncode(Eval("path").ToString()) + "\" title=\"上传文件\"><img src=\"upload.gif\" border=\"0\" align=\"absmiddle\"></a>" : ""%>
							<%#Convert.ToBoolean(Eval("isDirectory")) == true ? "<A href=\"changefolder.aspx?foldername=" + Server.UrlEncode(Eval("path").ToString()) + "\" title=\"属性/重命名\"><img src=\"props.gif\" border=\"0\" align=\"absmiddle\"></a>" : ""%>							
							</td>
						</tr>
					</ItemTemplate>
					<AlternatingItemTemplate>
					<tr class="TableLine2">
							<td nowrap  width="30" align="center">
							<input type="checkbox" runat="server"  id="PathId" onClick="CheckChanged();" name="PathId" value='<%# (Convert.ToBoolean(Eval("isDirectory")) == true) ? "DIR" + Eval("path") : "FILE" + Eval("path").ToString() %>' />
							</td>
							<td nowrap>
								<%#Convert.ToBoolean(Eval("isDirectory")) == true ? "<A href=\"index.aspx?path=" + Server.UrlEncode(Eval("path").ToString()) + "\">" : ""%>
								<%#Convert.ToBoolean(Eval("isDirectory")) == false ? "<A target=\"download_file\" href=\"download.aspx?filename=" + Server.UrlEncode(Eval("path").ToString()) + "\">" : ""%>
								<img src="/images/files/<%#Eval("img")%>" align="absMiddle" border="0">
								<%#Eval("name")%></a>	
								<%#Thumb(Eval("path").ToString(), "120") %>
								<%#OfficeMenu(Eval( "path").ToString())%>
							</td>
							<td nowrap align="center"><%#Convert.ToBoolean(Eval("isDirectory")) == false ? formatSize(Convert.ToInt32(Eval("size"))) : "-" %></td>
							<td noWrap align="center"><%#Convert.ToBoolean(Eval("isDirectory")) == true ? "目录" : "文件"%></td>
							<td nowrap align="center"><%#Eval("creationTime") %></td>
							<td nowrap width="80">
							&nbsp;
							<%#Convert.ToBoolean(Eval("isDirectory")) == false ? "<A target=\"download_file\" href=\"download.aspx?filename=" + Server.UrlEncode(Eval("path").ToString()) + "\" title=\"下载文件\"><img src=\"down.gif\" border=\"0\" align=\"absmiddle\"></a>" : ""%>
							<%#Convert.ToBoolean(Eval("isDirectory")) == false ? "<A href=\"changefile.aspx?filename=" + Server.UrlEncode(Eval("path").ToString()) + "\" title=\"属性/重命名\"><img src=\"props.gif\" border=\"0\" align=\"absmiddle\"></a>" : ""%>
							<%#Convert.ToBoolean(Eval("isDirectory")) == true ? "<A href=\"newfile.aspx?parent_folder=" + Server.UrlEncode(Eval("path").ToString()) + "\" title=\"上传文件\"><img src=\"upload.gif\" border=\"0\" align=\"absmiddle\"></a>" : ""%>
							<%#Convert.ToBoolean(Eval("isDirectory")) == true ? "<A href=\"changefolder.aspx?foldername=" + Server.UrlEncode(Eval("path").ToString()) + "\" title=\"属性/重命名\"><img src=\"props.gif\" border=\"0\" align=\"absmiddle\"></a>" : ""%>							
							</td>
						</tr>
					</AlternatingItemTemplate>
				</asp:Repeater>
				<tr class="TableControl">
					<td nowrap width="30" align="center"><INPUT id="checkAll" onClick="CheckAll(this);" type="checkbox" name="checkAll" runat="server"></td>
					<td nowrap colspan="5" align="right"><asp:Literal id="litStatic" runat="server"></asp:Literal></td>
				</tr>
			</table>
			  <div>
				<TABLE width="100%" class="div_cotr" cellpadding="0" cellspacing="0" border="0">
					<TR>
						<TD>
							<asp:button id="btnDelete" runat="server" CssClass="bnt05" Text="删 除" onclick="btnDelete_Click"></asp:button>
							<asp:Button id="btnNewFile" runat="server" CssClass="bnt06" Text="上传文件" onclick="btnNewFile_Click"></asp:Button></TD>
						<TD align="right">
							<asp:button id="btnMove" runat="server" CssClass="bnt05" Text="移动到" onclick="btnMove_Click"></asp:button>
							<asp:DropDownList id="destFolder" runat="server" CssClass="BigSelect"></asp:DropDownList>
						</TD>
					</TR>
				</TABLE>
			  </div>
				<TABLE width="90%" align="left">				
					<TR>
						<TD>0</TD>
						<TD width="50%">
							<TABLE width="100%" cellSpacing="1" cellPadding="1" width="100%" bgColor="#9EC4E8" border="0">				
							<TR>
								<TD width="<%=ViewState["Percent"] %>%" height="18" bgcolor="#F6AA58"></TD>
								<TD width="<%=100-Convert.ToInt32(ViewState["Percent"]) %>%" height="18" bgcolor="#ffffff"></TD>						
							</TR>
							</TABLE>
						</TD>
						<TD width="50%" nowrap><asp:Literal id="litWholeStatic" runat="server"></asp:Literal></TD>
					</TR>
				</TABLE>
			</asp:Panel>		
			<asp:Literal id="litMessage" runat="server"></asp:Literal>
            </div>
		</form>
	</body>
</HTML>
